//
//  LevelScreenConfig.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/8/8.
//
//

#include "CountDownModeLevelScreenConfig.h"


#define MATRIX_WIDTH (9)
#define MATRIX_HEIGHT (9)
#define TOTAL_UNIT (5)

#define GOLD_BASE_1    (6)
#define GOLD_GAP_1     (2)
#define GOLD_BASE_2    (50)
#define GOLD_GAP_2     (3)
#define GOLD_BASE_3    (140)
#define GOLD_GAP_3     (4)

int CountDownModeLevelScreenConfig::getMonsterType(int type) {
	return type;
}

int CountDownModeLevelScreenConfig::getBombNum(int type) {

	return 0;

}

int CountDownModeLevelScreenConfig::getWinGold(int type) {

	return 0;
}

bool* CountDownModeLevelScreenConfig::getBadStateMatrix(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType01: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[38] = true;
		m_matrix[47] = true;
		m_matrix[40] = true;
		m_matrix[49] = true;
		m_matrix[42] = true;
		m_matrix[51] = true;
		m_matrix[64] = true;
		m_matrix[73] = true;
		m_matrix[66] = true;
		m_matrix[75] = true;
		m_matrix[68] = true;
		m_matrix[77] = true;
		m_matrix[70] = true;
		m_matrix[79] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType02: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[0] = true;
		m_matrix[1] = true;
		m_matrix[2] = true;
		m_matrix[3] = true;
		m_matrix[4] = true;
		m_matrix[5] = true;
		m_matrix[6] = true;
		m_matrix[7] = true;
		m_matrix[8] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType03: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[55] = true;
		m_matrix[56] = true;
		m_matrix[57] = true;
		m_matrix[58] = true;
		m_matrix[59] = true;
		m_matrix[60] = true;
		m_matrix[61] = true;
		m_matrix[64] = true;
		m_matrix[65] = true;
		m_matrix[66] = true;
		m_matrix[67] = true;
		m_matrix[68] = true;
		m_matrix[69] = true;
		m_matrix[70] = true;
		m_matrix[73] = true;
		m_matrix[74] = true;
		m_matrix[75] = true;
		m_matrix[76] = true;
		m_matrix[77] = true;
		m_matrix[78] = true;
		m_matrix[79] = true;
		m_matrix[1] = true;
		m_matrix[2] = true;
		m_matrix[3] = true;
		m_matrix[4] = true;
		m_matrix[5] = true;
		m_matrix[6] = true;
		m_matrix[7] = true;
		m_matrix[10] = true;
		m_matrix[11] = true;
		m_matrix[12] = true;
		m_matrix[13] = true;
		m_matrix[14] = true;
		m_matrix[15] = true;
		m_matrix[16] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[21] = true;
		m_matrix[22] = true;
		m_matrix[23] = true;
		m_matrix[24] = true;
		m_matrix[25] = true;
		m_matrix[46] = true;
		m_matrix[47] = true;
		m_matrix[37] = true;
		m_matrix[38] = true;
		m_matrix[28] = true;
		m_matrix[29] = true;
		m_matrix[33] = true;
		m_matrix[34] = true;
		m_matrix[42] = true;
		m_matrix[43] = true;
		m_matrix[51] = true;
		m_matrix[52] = true;
		m_matrix[40] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType04: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType05: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[10] = true;
		m_matrix[11] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[15] = true;
		m_matrix[16] = true;
		m_matrix[24] = true;
		m_matrix[25] = true;
		m_matrix[55] = true;

		m_matrix[56] = true;
		m_matrix[64] = true;
		m_matrix[65] = true;
		m_matrix[60] = true;
		m_matrix[61] = true;
		m_matrix[69] = true;
		m_matrix[70] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType06: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[40] = true;
		m_matrix[0] = true;
		m_matrix[1] = true;
		m_matrix[2] = true;
		m_matrix[3] = true;
		m_matrix[5] = true;
		m_matrix[6] = true;
		m_matrix[7] = true;
		m_matrix[8] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType07: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[72] = true;
		m_matrix[80] = true;
		m_matrix[0] = true;
		m_matrix[8] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;

		m_matrix[56] = true;
		m_matrix[57] = true;
		m_matrix[58] = true;
		m_matrix[59] = true;
		m_matrix[60] = true;
		m_matrix[51] = true;
		m_matrix[42] = true;
		m_matrix[33] = true;
		m_matrix[24] = true;
		m_matrix[23] = true;
		m_matrix[22] = true;
		m_matrix[21] = true;
		m_matrix[20] = true;
		m_matrix[29] = true;
		m_matrix[38] = true;
		m_matrix[47] = true;

		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType08: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[56] = true;
		m_matrix[57] = true;
		m_matrix[58] = true;
		m_matrix[59] = true;
		m_matrix[60] = true;
		m_matrix[47] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[51] = true;
		m_matrix[38] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;

		m_matrix[41] = true;
		m_matrix[42] = true;
		m_matrix[29] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		m_matrix[33] = true;
		m_matrix[20] = true;
		m_matrix[21] = true;
		m_matrix[22] = true;
		m_matrix[23] = true;
		m_matrix[24] = true;

		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType09: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[64] = true;
		m_matrix[65] = true;
		m_matrix[66] = true;
		m_matrix[68] = true;
		m_matrix[69] = true;
		m_matrix[70] = true;
		m_matrix[55] = true;
		m_matrix[56] = true;
		m_matrix[60] = true;
		m_matrix[61] = true;
		m_matrix[46] = true;
		m_matrix[52] = true;
		m_matrix[28] = true;

		m_matrix[34] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[24] = true;
		m_matrix[25] = true;
		m_matrix[10] = true;
		m_matrix[11] = true;
		m_matrix[12] = true;
		m_matrix[14] = true;
		m_matrix[15] = true;
		m_matrix[16] = true;

		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType10: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[57] = true;
		m_matrix[58] = true;
		m_matrix[59] = true;
		m_matrix[47] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[51] = true;
		m_matrix[38] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[42] = true;

		m_matrix[29] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		m_matrix[33] = true;
		m_matrix[21] = true;
		m_matrix[22] = true;
		m_matrix[23] = true;

		m_matrix[65] = true;
		m_matrix[67] = true;
		m_matrix[69] = true;
		m_matrix[55] = true;
		m_matrix[56] = true;
		m_matrix[60] = true;
		m_matrix[61] = true;
		m_matrix[37] = true;

		m_matrix[43] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[24] = true;

		m_matrix[25] = true;
		m_matrix[11] = true;
		m_matrix[13] = true;
		m_matrix[15] = true;
		return m_matrix;
	}

	}
	return NULL;
}

bool* CountDownModeLevelScreenConfig::getBadUpStateMatrix(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType02: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[18] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[21] = true;
		m_matrix[22] = true;
		m_matrix[23] = true;
		m_matrix[24] = true;
		m_matrix[25] = true;
		m_matrix[26] = true;
		return m_matrix;
	}
	case CountDownModeLevelScreenTypeType03: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[0] = true;
		m_matrix[9] = true;
		m_matrix[18] = true;
		m_matrix[27] = true;
		m_matrix[36] = true;
		m_matrix[45] = true;
		m_matrix[54] = true;
		m_matrix[63] = true;
		m_matrix[72] = true;
		m_matrix[8] = true;
		m_matrix[17] = true;
		m_matrix[26] = true;
		m_matrix[35] = true;
		m_matrix[44] = true;
		m_matrix[53] = true;
		m_matrix[62] = true;
		m_matrix[71] = true;
		m_matrix[80] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType06: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[40] = true;
		m_matrix[0] = true;
		m_matrix[1] = true;
		m_matrix[2] = true;
		m_matrix[3] = true;
		m_matrix[5] = true;
		m_matrix[6] = true;
		m_matrix[7] = true;
		m_matrix[8] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType07: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[72] = true;
		m_matrix[80] = true;
		m_matrix[0] = true;
		m_matrix[8] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType08: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType09: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[64] = true;
		m_matrix[65] = true;
		m_matrix[66] = true;
		m_matrix[68] = true;
		m_matrix[69] = true;
		m_matrix[70] = true;
		m_matrix[55] = true;
		m_matrix[56] = true;
		m_matrix[60] = true;
		m_matrix[61] = true;
		m_matrix[46] = true;
		m_matrix[52] = true;
		m_matrix[28] = true;

		m_matrix[34] = true;
		m_matrix[19] = true;
		m_matrix[20] = true;
		m_matrix[24] = true;
		m_matrix[25] = true;
		m_matrix[10] = true;
		m_matrix[11] = true;
		m_matrix[12] = true;
		m_matrix[14] = true;
		m_matrix[15] = true;
		m_matrix[16] = true;

		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType10: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[57] = true;
		m_matrix[58] = true;
		m_matrix[59] = true;
		m_matrix[47] = true;
		m_matrix[48] = true;
		m_matrix[49] = true;
		m_matrix[50] = true;
		m_matrix[51] = true;
		m_matrix[38] = true;
		m_matrix[39] = true;
		m_matrix[40] = true;
		m_matrix[41] = true;
		m_matrix[42] = true;

		m_matrix[29] = true;
		m_matrix[30] = true;
		m_matrix[31] = true;
		m_matrix[32] = true;
		m_matrix[33] = true;
		m_matrix[21] = true;
		m_matrix[22] = true;
		m_matrix[23] = true;

		return m_matrix;
	}

	}
	return NULL;
}

bool* CountDownModeLevelScreenConfig::getJellyMatrix(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType02: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[9] = true;
		m_matrix[10] = true;
		m_matrix[11] = true;
		m_matrix[12] = true;
		m_matrix[13] = true;
		m_matrix[14] = true;
		m_matrix[15] = true;
		m_matrix[16] = true;
		m_matrix[17] = true;
		return m_matrix;
	}

	}
	return NULL;
}

bool* CountDownModeLevelScreenConfig::getProtectCoverMatrix(int type) {

	return NULL;
}

bool* CountDownModeLevelScreenConfig::getBlankMatrix(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType01: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[27] = 1;
		m_matrix[28] = 1;
		m_matrix[29] = 1;
		m_matrix[30] = 1;
		m_matrix[31] = 1;
		m_matrix[32] = 1;
		m_matrix[33] = 1;
		m_matrix[34] = 1;
		m_matrix[35] = 1;
		m_matrix[36] = 1;
		m_matrix[37] = 1;
		m_matrix[39] = 1;
		m_matrix[41] = 1;
		m_matrix[43] = 1;
		m_matrix[44] = 1;
		m_matrix[45] = 1;
		m_matrix[46] = 1;
		m_matrix[48] = 1;
		m_matrix[50] = 1;
		m_matrix[52] = 1;
		m_matrix[53] = 1;
		m_matrix[54] = 1;
		m_matrix[55] = 1;
		m_matrix[56] = 1;
		m_matrix[57] = 1;
		m_matrix[58] = 1;
		m_matrix[59] = 1;
		m_matrix[60] = 1;
		m_matrix[61] = 1;
		m_matrix[62] = 1;
		m_matrix[63] = 1;
		m_matrix[65] = 1;
		m_matrix[67] = 1;
		m_matrix[69] = 1;
		m_matrix[71] = 1;
		m_matrix[72] = 1;
		m_matrix[74] = 1;
		m_matrix[76] = 1;
		m_matrix[78] = 1;
		m_matrix[80] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType03: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[30] = 1;
		m_matrix[31] = 1;
		m_matrix[32] = 1;
		m_matrix[39] = 1;
		m_matrix[41] = 1;
		m_matrix[48] = 1;
		m_matrix[49] = 1;
		m_matrix[50] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType04: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[21] = 1;
		m_matrix[20] = 1;
		m_matrix[29] = 1;
		m_matrix[38] = 1;
		m_matrix[47] = 1;
		m_matrix[56] = 1;
		m_matrix[57] = 1;
		m_matrix[23] = 1;
		m_matrix[24] = 1;
		m_matrix[33] = 1;
		m_matrix[42] = 1;
		m_matrix[51] = 1;
		m_matrix[60] = 1;
		m_matrix[59] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType05: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[36] = 1;
		m_matrix[37] = 1;
		m_matrix[38] = 1;
		m_matrix[39] = 1;
		m_matrix[40] = 1;
		m_matrix[41] = 1;
		m_matrix[42] = 1;
		m_matrix[43] = 1;
		m_matrix[44] = 1;

		m_matrix[4] = 1;
		m_matrix[13] = 1;
		m_matrix[22] = 1;
		m_matrix[31] = 1;
		m_matrix[49] = 1;
		m_matrix[58] = 1;
		m_matrix[67] = 1;
		m_matrix[76] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType06: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[39] = 1;
		m_matrix[41] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType08: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[76] = 1;
		m_matrix[67] = 1;
		m_matrix[36] = 1;
		m_matrix[37] = 1;
		m_matrix[43] = 1;
		m_matrix[44] = 1;
		m_matrix[13] = 1;
		m_matrix[4] = 1;
		return m_matrix;
	}

	case CountDownModeLevelScreenTypeType10: {
		int arraySize = sizeof(bool) * MATRIX_WIDTH * MATRIX_HEIGHT;
		bool* m_matrix = (bool*) malloc(arraySize);
		memset((void*) m_matrix, 0, arraySize);
		m_matrix[48] = 1;
		m_matrix[50] = 1;
		m_matrix[30] = 1;
		m_matrix[32] = 1;

		return m_matrix;
	}

	}

	return NULL;
}

int CountDownModeLevelScreenConfig::getMoveStepLeft(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType01:
		return 60;
	case CountDownModeLevelScreenTypeType02:
		return 50;
	case CountDownModeLevelScreenTypeType03:
			return 35;
	case CountDownModeLevelScreenTypeType04:
			return 30;
	case CountDownModeLevelScreenTypeType05:
			return 17;
	case CountDownModeLevelScreenTypeType06:
			return 55;
	case CountDownModeLevelScreenTypeType07:
			return 50;
	case CountDownModeLevelScreenTypeType08:
			return 35;
	case CountDownModeLevelScreenTypeType09:
			return 40;
	case CountDownModeLevelScreenTypeType10:
			return 50;





	}
	return 60;
}

int CountDownModeLevelScreenConfig::getTypeNumLimit(int type) {
	switch (type) {
	case CountDownModeLevelScreenTypeType01:
		return 3;
	}
	return TOTAL_UNIT;
}
